<?
$media = $args['media'];
if (is_object($media) && !db::isError($media)) {
	if ($args['url']) {
		$url = $args['url'];
	} else {
		if (USE_MOD_REWRITE) {
			$url = SITE_WEB_DIRECTORY . '/media/';
		} else {
			$url = SITE_WEB_DIRECTORY . '/media.php';
		}
	}
	
	if (USE_MOD_REWRITE) {
		$url .= '/' . $mi->getID() . '/';
	} else {
		$url .= '&media_instance_id=' . $media->getID();
	}
	$title = $media->getTitle();
}